#include <iostream>
#include <stdio.h>
#include <cmath>

// 冒泡排序
void bubble_sort(int arr[],int n)
{
    for(int i = 0; i < n-1; i++)
    {
        for(int j = 0; j < n-1-i; j++)
        {
            if(arr[j] > arr[j+1])
            {
                int temp = arr[j];
                arr[j] = arr[j+1];
                arr[j+1] = temp;
            }
        }
    }
}



int main()
{
    int arr[5] = {3, 2, 1, 4, 5};
    bubble_sort(arr, 5);
    for(int i = 0; i < 5; i++)
    {
        std::cout << arr[i] << " ";
    }
    std::cout << "\n";

    return 0;
}